package com.wcar.common.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 
 * @TableName tb_user_integral
 */
@TableName(value ="tb_user_integral")
@Data
public class UserIntegral implements Serializable {
    /**
     * 积分ID
     */
    @TableId(type = IdType.AUTO)
    private Integer integralId;
    @TableField(exist = false)
    private String userName;

    /**
     * 用户ID，外键关联用户表
     */
    private Integer userId;

    /**
     * 积分数值
     */
    private BigDecimal credits;

    /**
     * 积分来源
     */
    private String source;
    /**
     * 积分记录创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date integralTime;

    /**
     * 店铺id
     */
    private Integer storeId;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     * 积分ID
     */
    public Integer getIntegralId() {
        return integralId;
    }

    /**
     * 积分ID
     */
    public void setIntegralId(Integer integralId) {
        this.integralId = integralId;
    }

    /**
     * 用户ID，外键关联用户表
     */
    public Integer getUserId() {
        return userId;
    }

    /**
     * 用户ID，外键关联用户表
     */
    public void setUserId(Integer userId) {
        this.userId = userId;
    }


    /**
     * 积分数值
     */


    /**
     * 积分来源
     */
    public String getSource() {
        return source;
    }

    /**
     * 积分来源
     */
    public void setSource(String source) {
        this.source = source;
    }

    /**
     * 积分记录创建时间
     */
    public Date getIntegralTime() {
        return integralTime;
    }

    /**
     * 积分记录创建时间
     */
    public void setIntegralTime(Date integralTime) {
        this.integralTime = integralTime;
    }

    /**
     * 店铺id
     */
    public Integer getStoreId() {
        return storeId;
    }

    /**
     * 店铺id
     */
    public void setStoreId(Integer storeId) {
        this.storeId = storeId;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserIntegral other = (UserIntegral) that;
        return (this.getIntegralId() == null ? other.getIntegralId() == null : this.getIntegralId().equals(other.getIntegralId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getCredits() == null ? other.getCredits() == null : this.getCredits().equals(other.getCredits()))
            && (this.getSource() == null ? other.getSource() == null : this.getSource().equals(other.getSource()))
            && (this.getIntegralTime() == null ? other.getIntegralTime() == null : this.getIntegralTime().equals(other.getIntegralTime()))
            && (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getIntegralId() == null) ? 0 : getIntegralId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getCredits() == null) ? 0 : getCredits().hashCode());
        result = prime * result + ((getSource() == null) ? 0 : getSource().hashCode());
        result = prime * result + ((getIntegralTime() == null) ? 0 : getIntegralTime().hashCode());
        result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", integralId=").append(integralId);
        sb.append(", userId=").append(userId);
        sb.append(", credits=").append(credits);
        sb.append(", source=").append(source);
        sb.append(", integralTime=").append(integralTime);
        sb.append(", storeId=").append(storeId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}